home *** CD-ROM | disk | FTP | other *** search
- class classes.fx.Shrapnel
- {
- var x;
- var y;
- var type;
- var id;
- var special;
- var color;
- var clip;
- var xMov;
- var yMov;
- var cMax;
- var ce;
- var rotateVar;
- var rotateInt;
- var c = 0;
- var smoker = false;
- var yank = false;
- var black = false;
- function Shrapnel(px, py, ptype, pcolor, pspecial, pblack, pid)
- {
- this.x = px;
- this.y = py;
- this.type = ptype;
- this.id = pid;
- this.special = pspecial;
- this.color = pcolor;
- this.black = pblack;
- if(this.special == undefined)
- {
- this.special = false;
- }
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("shrapnel","shrapnel" + this.id + "Clip",_root.d);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.xMov = _root.randRange(-5,5);
- this.yMov = _root.randRange(-5,5);
- this.cMax = _root.randRange(50,100);
- if(this.type.charAt(0) != "B")
- {
- var _loc3_ = _root[this.type + "Shrap"].slice();
- var _loc6_ = _loc3_[0];
- var _loc7_ = _loc3_[random(_loc3_.length - 1) + 1];
- if(_loc7_.charAt(0) == "C" && random(2) > 0)
- {
- this.clip.gotoAndPlay(this.type + _loc7_);
- this.smoker = true;
- }
- else
- {
- this.clip.bitColor = _loc7_;
- if(_loc6_ == "light")
- {
- this.clip.gotoAndPlay("generic1");
- }
- else
- {
- this.clip.gotoAndPlay("generic2");
- }
- }
- }
- else
- {
- _loc3_ = _root[this.type + "Shrap"].slice();
- _loc7_ = _loc3_[random(_loc3_.length)];
- this.clip.gotoAndPlay(this.type + _loc7_);
- this.smoker = true;
- }
- if(this.black)
- {
- var _loc4_ = new flash.geom.Transform(this.clip);
- var _loc5_ = new flash.geom.ColorTransform(0,0,0,1,-255,-255,-255,0);
- _loc4_.colorTransform = _loc5_;
- }
- this.ce = _root.randRange(15,150);
- this.rotateVar = random(2) <= 0 ? -1 : 1;
- this.rotateInt = _root.randRange(2,5);
- if(this.smoker)
- {
- this.rotateInt = this.rotateInt + 1;
- }
- if(this.special)
- {
- this.cMax = 1000;
- }
- }
- function main()
- {
- this.c = this.c + 1;
- if(this.c / this.rotateInt == Math.round(this.c / this.rotateInt))
- {
- this.clip._rotation += 90 * this.rotateVar;
- }
- if(this.c >= this.cMax)
- {
- this.yank = true;
- }
- if(this.smoker)
- {
- if(random(10) > 8)
- {
- _root.shrapID = _root.shrapID + 1;
- _root["shipSmoke" + _root.shrapID] = new classes.fx.ShipSmoke(this.x,this.y,_root.shrapID,this.black);
- _root.addFX("shipSmoke" + _root.shrapID);
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].nudge(this.xMov * 1.5,this.yMov * 1.5,this.clip._alpha * 2);
- }
- }
- if(this.c == this.ce)
- {
- if(this.black && this.color == "")
- {
- if(this.special)
- {
- _root.createExploD([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(50,80),90]);
- }
- else
- {
- _root.createExploD([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(30,60),75 - this.c * (100 / this.cMax)]);
- }
- }
- else if(this.special)
- {
- if(this.black)
- {
- var _loc3_ = 0;
- var _loc4_ = _root.randRange(1,3);
- while(_loc3_ < _loc4_)
- {
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-25,25),this.y + this.clip._height / 2 + _root.randRange(-25,25),_root.randRange(75,150),90,this.color]);
- _loc3_ = _loc3_ + 1;
- }
- }
- else
- {
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(50,80),90,this.color]);
- }
- }
- else
- {
- _root.createExploA([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(30,60),75 - this.c * (100 / this.cMax),this.color]);
- }
- _root.audio.playLevel4("shrapX" + random(5),_root.randRange(5,15));
- this.yank = true;
- }
- if(!this.special)
- {
- this.clip._alpha = 110 - this.c * (110 / this.cMax);
- }
- if(this.yank)
- {
- _root.removeFX("shrapnel" + this.id);
- }
- this.x += this.xMov;
- this.y += this.yMov;
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-